home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
cxt220.zip
/
EXAMPLE.DOC
< prev
next >
Wrap
Text File
|
1994-03-20
|
24KB
|
794 lines
EXAMPLE.DOC
This file describes the use of CFT and CST, the main parts of
CXT, the C EXPLORATION TOOLS. The example session shows the
processing of a small program composed of two source files X1.C
and X2.C and one include file X.H as listed below. When invoked,
the program produces the following output:
hello world ....................
The source code of the files is as follows:
SOURCE LISTING 1: X1.C
#include <stdio.h>
#include "x.h"
WORD main(void);
VOID x1(void);
WORD main(void)
{
x1();
y1();
return(0);
}
static VOID x2(void)
{
printf("hello ");
}
VOID x1(VOID)
{
x2();
}
END OF SOURCE LISTING 1
SOURCE LISTING 2: X2.C
#include <stdio.h>
#include "x.h"
VOID y1(VOID);
static int x1(void);
static void x3(void);
VOID y1(VOID)
{
x1();
}
static char x2(VOID)
{
printf("world ");
x3();
return(1);
}
- 1 -
static int x1(void)
{
x2();
return(1);
}
static void x3(void)
{
static i = 0;
printf(".");
if (++i < 20)
x3();
}
END OF SOURCE LISTING 2
SOURCE LISTING 3: X.H
typedef void VOID;
typedef char BYTE;
typedef int WORD;
typedef long DWORD;
typedef struct _s_x
{
BYTE a;
WORD b;
BYTE string[20];
FILE *fptr;
} S_XT;
extern VOID y1(VOID);
END OF SOURCE LISTING 3
First of all, the two source files X1.C and X2.C are processed by
CFT to look for the functions and their hierarchy with the
following command line (see documentation for description):
CFT -m -rauspMP -TMSC70,L -cs -Cs -na -Zs -z x?.c
The resulting screen output during processing is shown below.
Besides the default informations about the file actually
processed there are also some warnings given. (NOTE: Some of the
following output lines are truncated due to their length.)
SCREEN OUTPUT
CFT (TM) C FUNCTION TREE GENERATOR 2.12 Copyright (C) J.M 1988-
processing C:/C/CXT/DOC/X1.C
C:/C/CXT/DOC/X1.C(15): warning: function 'x2' definition used as
prototype
processing C:/C/CXT/DOC/X2.C
C:/C/CXT/DOC/X2.C(14): warning: function 'x2' definition used as
prototype
- 2 -
writing output file CFT.LST
END OF SCREEN OUTPUT
The finally generated output file CFT.LST has the following
listed contents. For further informations about the meaning of
the several sections listed in the output file see the CFT and
CST documentation.
CFT OUTPUT: CFT.LST
╔═══════════════════════════════════════════════════════════════
║ CFT (TM) C FUNCTION TREE GENERATOR 2.12 Copyright (C) J.M
╚═══════════════════════════════════════════════════════════════
╔═══════════════════════════════════════════════════════════════
║ CFT is part of CXT - the C EXPLORATION TOOLS
║ You are expressly prohibited from selling this software
║ of it in any form, distributing it with another product
║ removing this notice. This software is Copyright (C)
║ File creation date: Sat Nov 21 13:08:22 1992
╚═══════════════════════════════════════════════════════════════
╔═══════════════════════════════════════════════════════════════
║ EXAMPLE: int test() (9999) <DMPCA> <TEST.C, 100>
║ - int : function return type
║ - test() : function name
║ - (9999) : function cross reference number
║ - <DMPCA> : function found as D=definition, M=macro, P=P
║ C=function call, A=assembler function
║ - <TEST.C, 100>: file name, line number
╚═══════════════════════════════════════════════════════════════
╔═══════════════════════════════════════════════════════════════
║ FUNCTION CALLTREE HIERARCHY LISTING
╚═══════════════════════════════════════════════════════════════
WORD main() (1) <DP> <X1.C, 8>
├ VOID x1() (2) <DPC> <X1.C, 20>
│ └ static VOID x2() (3) <DC> <X1.C, 15>
│ └ int printf() (4) <PC> <?>
│
└ VOID y1() (5) <DPC> <X2.C, 9>
└ static int x1() (6) <DPC> <X2.C, 21>
└ static char x2() (7) <DC> <X2.C, 14>
├ int printf()
└ static void x3() (8) <DPC> <X2.C, 27>
├ int printf()
└ static void x3() ...recursive call of (8)
WORD main() ...relations shown at (1)
int printf() ...relations shown at (4)
- 3 -
VOID x1() ...relations shown at (2)
static int x1() ...relations shown at (6)
static VOID x2() ...relations shown at (3)
static char x2() ...relations shown at (7)
static void x3() ...relations shown at (8)
VOID y1() ...relations shown at (5)
╔═══════════════════════════════════════════════════════════════
║ TOTAL NUMBER OF FUNCTIONS REFERENCED : 8
║ NUMBER OF FUNCTION DEFINITIONS : 7
║ NUMBER OF UNDEFINED FUNCTIONS : 1
║ DIRECTED CALL GRAPH WITH 8 NODES AND 10 CONNECTI
╚═══════════════════════════════════════════════════════════════
╔═══════════════════════════════════════════════════════════════
║ UNDEFINED FUNCTIONS
╚═══════════════════════════════════════════════════════════════
int printf() (4) <PC> ...first found in <STDIO.H, 256>
╔═══════════════════════════════════════════════════════════════
║ FUNCTION CALL STATISTICS
╚═══════════════════════════════════════════════════════════════
VOID x1() (2) <DPC> <1 calls>
static int x1() (6) <DPC> <1 calls>
static VOID x2() (3) <DC> <1 calls>
static char x2() (7) <DC> <1 calls>
VOID y1() (5) <DPC> <1 calls>
static void x3() (8) <DPC> <2 calls>
int printf() (4) <PC> <3 calls>
╔═══════════════════════════════════════════════════════════════
║ FUNCTION CALLER-MEMBER LIST
╚═══════════════════════════════════════════════════════════════
<no callers>
main() (1) <0, 2>
x1() (2) <1>
y1() (5) <1>
- 4 -
main() (1) <1>
x1() (2) <1, 1>
x2() (3) <1>
y1() (5) <1>
x1() (6) <1, 1>
x2() (7) <1>
x1() (2) <1>
x2() (3) <1, 1>
printf() (4) <1>
x1() (6) <1>
x2() (7) <1, 2>
printf() (4) <1>
x3() (8) <1>
main() (1) <1>
y